package com.wbp.cms.qatest.dao;

import java.util.List;

import javax.annotation.Resource;

import org.junit.Test;

import com.wbp.cms.client.common.domain.OrganizationDO;
import com.wbp.cms.core.dao.OrganizationDAO;
import com.wbp.cms.qatest.BaseTest;


/**
 * @Description:
 * @Department:
 * @author andy.lhc
 * @date 2016年3月9日 下午8:10:56
 */
public class OrganizationDAOTest extends BaseTest {

  @Resource
  private OrganizationDAO organizationDAO;

  @Test
  public void insert_001() {

    OrganizationDO organizationDO = new OrganizationDO();
    organizationDO.setName("总经理");
    organizationDO.setIcon("dddddddd");
    Long id = organizationDAO.insert(organizationDO);
    System.out.println(id);
  }

  @Test
  public void insert_002() {

    OrganizationDO organizationDO = new OrganizationDO();
    organizationDO.setName("分销经理");
    organizationDO.setIcon("ffffffff");
    organizationDO.setParentId(1L);
    Long id = organizationDAO.insert(organizationDO);
    System.out.println(id);
  }

  @Test
  public void insert_003() {

    OrganizationDO organizationDO = new OrganizationDO();
    organizationDO.setName("杭州基金经理");
    organizationDO.setIcon("cccccccc");
    organizationDO.setParentId(2L);
    Long id = organizationDAO.insert(organizationDO);
    System.out.println(id);
  }

  @Test
  public void insert_004() {

    OrganizationDO organizationDO = new OrganizationDO();
    organizationDO.setName("上海基金经理");
    organizationDO.setIcon("dddddddd");
    organizationDO.setParentId(2L);
    Long id = organizationDAO.insert(organizationDO);
    System.out.println(id);
  }

  @Test
  public void insert_update() {

    OrganizationDO organizationDO = new OrganizationDO();
    organizationDO.setName("上海基金经理");
    organizationDO.setIcon("jjjjjj");
    organizationDO.setParentId(0L);
    organizationDO.setId(4L);
    int id = organizationDAO.update(organizationDO);
    System.out.println(id == 1);
  }

  @Test
  public void test_query() {

    List<OrganizationDO> list = organizationDAO.queryChildOrganization(1L);
    System.out.println("size: " + list.size());
    System.out.println("list: " + list);
  }

}
